package com.dt76.smallloanbackenduser.controller.afterloan;


import com.dt76.smallloanbackenduser.pojo.afterloan.SettlementCommitInfo;
import com.dt76.smallloanbackenduser.pojo.afterloan.SettlementQualification;
import com.dt76.smallloanbackenduser.remote.afterloan.SettlementRemote;
import com.dt76.smallloanbackenduser.utils.PageResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class SettlementController {

    private final SettlementRemote settlementRemote;

    public SettlementController(SettlementRemote settlementRemote) {
        this.settlementRemote = settlementRemote;
    }

    @GetMapping("/loanSettlement")
    public String toSettlementManager() {
        return "pages/afterloan/laonSettlementManager";
    }

    @ResponseBody
    @PostMapping("/loanSettlement/list/{page}/{size}")
    public PageResult getPageAll(@RequestBody SettlementQualification q, @PathVariable Integer page, @PathVariable Integer size) {
        return settlementRemote.getPageAll(q, page, size);
    }

    @ResponseBody
    @PostMapping("/loanSettlement/commit/{loanId}")
    public Integer getCommitInfo(@RequestBody SettlementCommitInfo q, @PathVariable Integer loanId) {
        return settlementRemote.getCommitInfo(q, loanId);
    }


}
